package userTag

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method "GET"
        url value(consumer(regex("api/programs/\\d+/tags")),
                producer("api/programs/1/tags"))
    }
    response {
        status 200
        body("""
            [{   
                "id": 1,
                "name": "222",
                "creatorId": 1,
                "programId": 1
            }]
        """)
        bodyMatchers {
            jsonPath('$.[*]', byType())
            jsonPath('$.[*].id', byRegex(number()))
            jsonPath('$.[*].name', byRegex(nonEmpty()))
            jsonPath('$.[*].creatorId', byRegex(number()))
            jsonPath('$.[*].programId', byRegex(number()))
        }
        headers {
            contentType(applicationJsonUtf8())
        }
    }

}
